home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / yrndl13.zip / yarndial.cmd < prev    next >
OS/2 REXX Batch file  |  1996-07-20  |  54KB  |  1,669 lines

  1. /* YARNDIAL.CMD v 1.3 (beta) by Jerry Levy     20 Jul 1996
  2. Comments appreciated: send to jlevy@ibm.net
  3. (Jerry Levy, Marblehead, MA USA) */
  4.  
  5. version = '1.3 (beta)'
  6.  
  7. /*
  8. ======================History=========================
  9. 20 Jul 96 v. 1.3 (beta)
  10. Numerous additions and major cleanup of the code.
  11. Added a separate installer.
  12. Now can choose between use of
  13.   Advantis IAK Dialer
  14.   SLIPPM.EXE Dial-Other-Internet-Providers utility
  15.   SLIP.EXE or PPP.EXE dialup strings
  16.   IN-JOY Dialer
  17.   other dialup strings (you name it)
  18.  
  19. 11 Jun 95    YRNDIAL1 (v 1.1)
  20. Fixed screwed up backing up of the replies .Zip file
  21.  
  22. 11 Jun 95    YARNDIAL (1.0, original)
  23.  
  24.  
  25. ==========COPYRIGHT NOTICE AND DISCLAIMER=============
  26. YDINSTL.CMD is Copyright 1996 by Jerry Levy (all rights reserved)
  27. YARNDIAL.CMD is Copyright 1995 and 1996 by Jerry Levy (all rights reserved)
  28.  
  29. These are provided as-is and without charge, with no warranty expressed
  30. or implied as to merchantability or fitness for any particular purpose.  All
  31. responsibility for any and all incidental and consequential damages is
  32. disclaimed.  These programs and associated text files are freeware.  They
  33. may be distributed without restriction providing: (1) this notice and
  34. disclaimer remain intact, (2) all programs and files are included and
  35. unchanged, and (3) they are distributed either in the original .zip archive
  36. or the archive after being unzipped into a folder or onto a disk or other
  37. medium.  Use of either or both of these programs constitutes acceptance
  38. of these terms by all users.
  39.  
  40. ================INSTALLATION======================
  41. You could read YD.DOC.
  42. Or you could read README.1ST (shorter, recommended).
  43.  
  44. If YARN and SOUPER are installed and run OK...
  45.  
  46. ...and if you are using the IAK Dialer to connect to Advantis,
  47. or the Dial-Other-Internet_Providers utility (SLIPPM.EXE)...
  48.  
  49. then just run YDINSTL.CMD.
  50. ==================================================
  51.  
  52. */
  53.  
  54. arg otherparms        /* for later contingency */
  55.  
  56. cr = d2c(13)        /* enter key, as well as carriage return */
  57. crlf = d2c(13) || d2c(10)    /* carriage return + linefeed */
  58. escape = d2c(27)    /* escape character */
  59. ctrl_R = d2c(18)
  60. bs = d2c(8)    /* Backspace */
  61. tab = d2c(9)    /* tab */
  62. X1 = d2c(0)    /* Extended key */
  63. X2 = d2c(224)    /* Extended key */
  64.  
  65. say ''
  66. say 'YRNDIAL.CMD v' || version
  67. say '(c) 1995 & 1996 by Jerry Levy (all rights reserved)'
  68. say 'jlevy@ibm.net    Marblehead, MA USA'
  69. say ''
  70. say 'Dials in, gets or posts news, mail and replies'
  71. say 'and signs off when done.' crlf
  72. time1 = time()
  73. date1 = date('S')
  74. date1 = left(date1,4) || '/' || substr(date1,5,2) || '/' || right(date1,2)
  75. /* format date as yyyy/mm/dd */
  76.  
  77. /* This program has been tested with various recent YARN and
  78. SOUPER versions through YRN2_091 and SOUPER15 */
  79.  
  80. signal on failure
  81. signal on halt
  82. signal on syntax
  83. signal on notready
  84. signal on error
  85.  
  86. trace 'N'
  87.  
  88. timeout = 0
  89. /* Flag is reset to 1 if dialer times out */
  90.  
  91. Abandon = 0     /* Initialize*/
  92. replies_zip = 1    /* if we try to export mail and there is none, this is reset to 0 */
  93. do_catchup_on_news = 0    /* initialize the flag to no news catchup */
  94.  
  95. /* MAIN PROGRAM */
  96.  
  97. /* Load Rexx Util functions if not already loaded */
  98. if RxFuncQuery('SysLoadFuncs') \= 0 then
  99.    do
  100.       call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  101.       call SysLoadFuncs
  102.    end
  103.  
  104. /* Initialize these filenames */
  105. go_exe = 'GO.EXE'
  106. ydinstl_cmd = 'YDINSTL.CMD'
  107. ydparms_dat = 'YD_PARMS.DAT'
  108. injoy_exe = 'IN-JOY.EXE'
  109. slippm_exe = 'SLIPPM.EXE'
  110. IAKdialer_exe = 'DIALER.EXE'
  111.  
  112. '@echo off'                /* No echoing of any os/2 commands */
  113. home = directory()            /* Where we are executing this pgm from */
  114. home = translate(home)
  115. ydparms_dat = home || '\' || ydparms_dat /* All the parameters we need are here */
  116. /* Abort if can't locate the ydparms_dat.  Means we never ran the installer */
  117. if stream(ydparms_dat, 'c', 'query exists') = '' then
  118.    do
  119.       go_exe = home || '\' || go_exe    /* assume that's where it is */
  120.       call beep 1000, 200
  121.       say 'Cannot find YD_PARMS.DAT file with parameters needed to run.'
  122.       say 'This is normal if you have not run the installer,' YDINSTL_cmd
  123.       say 'or have not run it specifying a valid home directory.'
  124.       say ''
  125.       say 'Aborting.  Press any key to exit.  Then run' YDINSTL_cmd
  126.       call SysGetKey 'NOECHO'
  127.       signal goodbye
  128.    end
  129.  
  130. say 'Please wait while parameters load and we set up...'
  131. call parms_from_ydparms_dat        /* Read in all the parameters from the datafile */
  132.  
  133. /*
  134. ====================
  135. (Re)set HOME and YARN environmental variables.
  136. Later, in the dialup_server() routine, we will (re)set the NNTPSERVER (newsserver) environmental variable.  In that routine we first decide which parameter from
  137. the yd_parms.dat file has the correct newsserver assignment, then we set
  138. NNTPSERVER to that
  139. ====================
  140. */
  141.  
  142. x = SetLocal()
  143. x = value('home', home, 'OS2ENVIRONMENT')
  144. x = value('yarn', yarn, 'OS2ENVIRONMENT')
  145.  
  146. /* We look for some obvious inconsistencies or omissions in YDPARMS_DAT */
  147. call fatal_error_check
  148.  
  149. call directory_maintenance
  150.  
  151. /* are we connected? to whom? is it the right connection? */
  152. call get_current_connection
  153.  
  154. /*
  155. =============================================
  156. This is the main menu.  Point of interest: if we select 7
  157. (souper options) we first dial in to the system and only
  158. after we're connected do we get to select the options.
  159. Then we get another menu asking if we want to get/send
  160. stuff.
  161. =============================================
  162. */
  163.    say ''
  164.    say 'Press:'
  165.    say '1  Only import Mail'
  166.    say '2  Only import News Articles'
  167.    say '3  Only import, but both Mail AND News'
  168.    say '4  Only export (send Mail, Posts, Replies, and Follow-ups)'
  169.    say '5  Everything: Get mail and news AND send Posts, Replies, and Follow-ups'
  170.    say '6  Complete an interrupted importation of mail/news'
  171.    say '         or rebuild a corrupted YARN history file'
  172.    say '7  Souper options:  one-time-only changes in how souper runs:'
  173.    say '      Catchup on News'
  174.    say '      Maximum News Packet Size'
  175.    say '      Do not retrieve newsgroup articles Longer than set number of lines'
  176.    say '      Read-only for Mail: Don''t empty POP3 Mailbox'
  177.    say 'Pressing Esc key exits now.  Enter Selection:'
  178.  
  179. do until pos(choice, '1234567') \= 0 
  180.    choice = SysGetKey('NOECHO')
  181.    select
  182.       when choice = Escape then signal goodbye
  183.       when pos(choice, '1234567') = 0 then
  184.          do
  185.             say ''
  186.             say 'Selection' choice || '.  Must be 1-7 or Escape key.  Try again...'
  187.             say ''
  188.         end
  189.       otherwise NOP
  190.    end
  191.    say ''
  192.    say 'Selection: ' choice
  193.    say ''
  194. end
  195.  
  196. /*
  197. ====================
  198. A home\replies folder (empty) may be left behind as trash
  199. after execution of mail/news retrieval from some Yarn/Souper
  200. installations. We get rid of it if your setup of Yarn/Souper
  201. leaves one behind.
  202. ====================
  203. */
  204. replies_dir = home || '\replies'
  205. call SysRmDir replies_dir
  206.  
  207.    /* Fix the interrupted import */
  208. if choice = pos(choice, 'xxxxx6x') then
  209.    do
  210.       call fix_import
  211.       signal goodbye            /* Exit the program when done */
  212.    end
  213. if choice = pos(choice, 'xxxxxx7') then
  214.    do
  215.       call SysCls
  216.       say ''
  217.       say 'You selected to modify souper options.'
  218.       say ''
  219.       say 'We will first dial in.'
  220.       say ''
  221.       say 'After a connection is successfully established you will'
  222.       say 'be asked to select your one-time-only souper options.'
  223.       say ''
  224.       say 'When you are finished with that, another menu will pop'
  225.       say 'up asking if you want to get news or mail, or send posts.'
  226.       say ''
  227.       say 'To quit now, press Escape'
  228.       say 'Any other key starts the dialup connection'
  229.       if SysGetKey('NOECHO') = Escape then signal goodbye
  230.       else NOP
  231.     end
  232. call dialup_server
  233. call time('R')        /* start clock recording time on line */
  234.  
  235. /*
  236. =================
  237. These next conditionals process selections we made from the main menu.
  238. =================
  239. */
  240.       if choice = pos(choice, 'xxxxxx7') then
  241.          do
  242.